package com.capgemini.data;

import com.capgemini.daos.PersistableObject;

public class OlympicAdress implements PersistableObject {

	private Long id;

	private Person person;

	private String streetName;
	private int streetNumber;
	private String city;

	public OlympicAdress() {
	}

	public OlympicAdress(String streetName, int streetNumber, String city) {
		super();
		this.streetName = streetName;
		this.streetNumber = streetNumber;
		this.city = city;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getStreetName() {
		return streetName;
	}

	public void setStreetName(String streetName) {
		this.streetName = streetName;
	}

	public int getStreetNumber() {
		return streetNumber;
	}

	public void setStreetNumber(int streetNumber) {
		this.streetNumber = streetNumber;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	@Override
	public Class getEntityClass() {
		return OlympicAdress.class;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((city == null) ? 0 : city.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((person == null) ? 0 : person.hashCode());
		result = prime * result
				+ ((streetName == null) ? 0 : streetName.hashCode());
		result = prime * result + streetNumber;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		OlympicAdress other = (OlympicAdress) obj;
		if (city == null) {
			if (other.city != null)
				return false;
		} else if (!city.equals(other.city))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;

		if (person == null) {
			if (other.person != null)
				return false;
		} else if (!person.equals(other.person))
			return false;

		if (streetName == null) {
			if (other.streetName != null)
				return false;
		} else if (!streetName.equals(other.streetName))
			return false;
		if (streetNumber != other.streetNumber)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "OlympicAdress [id=" + id + ", person=" + person
				+ ", streetName=" + streetName + ", streetNumber="
				+ streetNumber + ", city=" + city + "]";
	}

	public String toPersistString() {
		return "OlympicAdress [id=" + id + ", streetName=" + streetName
				+ ", streetNumber=" + streetNumber + ", city=" + city + "]";
	}
}
